package stateAAs {
	import org.agony2d.gpu.FusionAA;
	import org.agony2d.gpu.ImageAA;
	import org.agony2d.gpu.StateAA;
	import org.agony2d.input.ATouchEvent;
	import org.agony2d.input.TouchManager;
	import org.agony2d.notify.AEvent;
	
public class Collide_StateAA extends StateAA {
  
	/** overwritable... */
	override public function get smoothing() : Boolean {
		return true
	}
	
	/** overwritable... */
	override public function get tinted() : Boolean {
		return true
	}
	
	/** overwrite... */
	override public function get fullTex() : String {
		return "B"
	}
	
	/** overwrite... */
	override public function enter() : void {
		{
			mFusion = new FusionAA
			this.group.addNode(mFusion)
			
			{
				img = new ImageAA
				img.textureData = FULL_TEX
				mFusion.addNode(img)
				img.x = img.y = 200
				//img.scaleX  = -1
				//img.rotation = 30
				img.pivotX = img.pivotY = 50
				
				img = new ImageAA
				img.textureData = FULL_TEX
				mFusion.addNode(img)
				img.x = 400
				img.y = 300
				img.scaleX  = -1
				img.rotation = 30
				img.pivotX = img.pivotY = 50
				
				img = new ImageAA
				img.textureData = FULL_TEX
				mFusion.addNode(img)
				img.x = img.y = 100
				//img.scaleX  = 2
				img.rotation = 30
				img.pivotX = img.pivotY = 50
				//img.setCollisionMethod(onCollision)
				
				
				img.addEventListener(AEvent.PRESS, onTouch)
				img.addEventListener(AEvent.RELEASE, onTouch)
				img.addEventListener(AEvent.MOVE, onTouch)
				img.addEventListener(AEvent.OVER, onTouch)
				img.addEventListener(AEvent.LEAVE, onTouch)
				img.addEventListener(AEvent.CLICK, onTouch)
			}
		}
		
		//TouchManager.getInstance().addEventListener(ATouchEvent.NEW_TOUCH, onNewTouch)
	}
	
	
	
	private var img:ImageAA
	private var mFusion:FusionAA
	
	
	private function onTouch(e:AEvent):void {
		trace(e.type)
	}
	
	private function onNewTouch(e:ATouchEvent):void {
		trace(this.group.world.collide(e.touch.stageX, e.touch.stageY))
	}
	
	//private function onCollision( localX:Number, localY:Number ) : Boolean {
		//if (Math.sqrt(localX * localX + localY * localY) < 50) {
			//return true
		//}
		//return false
	//}
}
}